var path = require('path')
const R = require('ramda');
var pathRead = require('hy5b/backend/path-read')

function ls(path) {
  return new Promise((resolve, reject) => {
    let files = []
    pathRead(path, function(err, str, fileName) {
      if (!err) {
        files.push(fileName)
      }
    }, function() {
      resolve(files)
    })
  })
}

const basenameWithoutExt = R.curry(path.basename)
var test = item => !item.includes('index') && !item.includes('getMapName') && !item.includes('parse')

var fn = R.pipe(
  R.map(basenameWithoutExt(R.__, '.js')),
  R.filter(test),
  // R.map(R.replace('N', R.__, 'N,')),
  // R.map(R.replace(/N/g, R.__, "import N from './N.js'")),
  
  // R.map(item => console.log('import', item, "from './" + item + ".js'"))
  R.map(item => console.log(item + ','))
)

var fileDirectory = path.resolve(__dirname, '../../repository/show/uyun-dash/packages/dash/services/chart/src/converter/parsers');

ls(fileDirectory).then(fn)